Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ

specs/20260511-211823-compose-screenshot-testing/plan.md docs/obtainium-generated-deeplinks (42f311dd) Text, 7.46 KB

Implementation Plan: Compose Preview Screenshot Testing

Branch: T383838018-compose-screenshot-testing | Date: 2026-05-08 | Spec: spec.md
Input: Feature specification from T383838specs/018-compose-screenshot-testing/spec.md

Summary

Integrate the official Compose Preview Screenshot Testing (CST) plugin into the Meshtastic Android KMP project. A dedicated Android-only T383838screenshot-tests/ module imports T383838commonMain preview composables from KMP feature and core modules, runs host-side JVM screenshot validation (no emulator), and feeds reference images into the docs pipeline and CI checks. Existing previews are audited for visibility/theming, and new previews are added for uncovered modules to achieve 80%+ component coverage.

Technical Context

Language/Version: Kotlin 2.3.21, JDK 21
Primary Dependencies: AGP 9.2.1, CMP 1.11.0-rc01, CST plugin 0.0.1-alpha14, screenshot-validation-api 0.0.1-alpha14
Storage: N/A β€” reference images stored as PNGs in version control
Testing: CST T383838validateDebugScreenshotTest (host-side JVM, no emulator)
Target Platform: Android (screenshot tests); previews authored in CMP T383838commonMain (Android + Desktop)
Project Type: Mobile app (KMP) with Android-only screenshot testing module
Performance Goals: Validation task completes in <60 seconds for the full preview suite
Constraints: CST plugin is Android-only; cannot apply to KMP modules directly
Scale/Scope: ~50+ preview composables across ~10 modules, generating ~100+ reference images

Constitution Check (Pre-Design)

GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.

β€’ I. Kotlin Multiplatform Core: βœ… PASS β€” Preview composables are authored in T383838commonMain using CMP T383838@Preview/T383838@PreviewLightDark. The T383838screenshot-tests/ module is intentionally Android-only (it is a test harness, not business logic). No T383838java.* or T383838android.* imports are added to any T383838commonMain source set. Platform-specific work is isolated to the screenshot test module and CI workflow.

β€’ II. Zero Lint Tolerance: βœ… PASS β€” The T383838screenshot-tests module will apply T383838meshtastic.detekt and T383838meshtastic.spotless convention plugins. Verification commands:
β€’ T383838./gradlew :screenshot-tests:detekt
β€’ T383838./gradlew spotlessApply spotlessCheck
β€’ All existing module lint commands remain unchanged.

β€’ III. Compose Multiplatform UI: βœ… PASS β€” All preview composables use CMP T383838@Preview/T383838@PreviewLightDark from T383838androidx.compose.ui.tooling.preview (CMP 1.11+ uses identical package to Jetpack). Previews wrap content in T383838AppTheme (CMP, not Android-only). No navigation or float formatting in scope (previews are stateless component snapshots).

β€’ IV. Privacy First: βœ… PASS β€” Preview sample data uses hardcoded synthetic values only. No PII, location data, or cryptographic keys. No modifications to T383838core/proto submodule. Reference images contain only synthetic UI renderings.

β€’ V. Design Standards Compliance: βœ… N/A β€” This feature does not introduce new user-facing screens. Preview composables render existing components. The previews themselves serve as a visual audit tool to verify design standards compliance.

β€’ VI. Verify Before Push: βœ… PASS β€” Local verification commands:
T282828
./gradlew spotlessApply detekt assembleDebug Tffa657test allTests :screenshot-tests:validateFdroidDebugScreenshotTest

Post-push CI check:
T282828
gh pr checks <PR_NUMBER>

Project Structure

Documentation (this feature)

T282828
specs/018-compose-screenshot-testing/
β”œβ”€β”€ plan.md # This file
β”œβ”€β”€ research.md # Phase 0 output β€” technology decisions
β”œβ”€β”€ data-model.md # Phase 1 output β€” entity catalog
β”œβ”€β”€ quickstart.md # Phase 1 output β€” contributor guide
└── tasks.md # Phase 2 output (created by /speckit.tasks)

Source Code (repository root)

T282828
screenshot-tests/
β”œβ”€β”€ build.gradle.kts # Android library + CST plugin
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ main/
β”‚ β”‚ └── AndroidManifest.xml # Minimal manifest
β”‚ β”œβ”€β”€ screenshotTest/
β”‚ β”‚ └── kotlin/org/meshtastic/screenshots/
β”‚ β”‚ β”œβ”€β”€ core/ # @PreviewTest wrappers for core/ui previews
β”‚ β”‚ β”‚ β”œβ”€β”€ AlertScreenshotTests.kt
β”‚ β”‚ β”‚ β”œβ”€β”€ ComponentScreenshotTests.kt
β”‚ β”‚ β”‚ └── ...
β”‚ β”‚ └── feature/ # @PreviewTest wrappers for feature previews
β”‚ β”‚ β”œβ”€β”€ MessagingScreenshotTests.kt
β”‚ β”‚ β”œβ”€β”€ NodeScreenshotTests.kt
β”‚ β”‚ β”œβ”€β”€ ConnectionsScreenshotTests.kt
β”‚ β”‚ β”œβ”€β”€ SettingsScreenshotTests.kt
β”‚ β”‚ β”œβ”€β”€ FirmwareScreenshotTests.kt
β”‚ β”‚ └── WifiProvisionScreenshotTests.kt
β”‚ └── screenshotTestDebug/
β”‚ └── reference/ # Git-tracked reference PNGs
β”‚ └── *.png

gradle/libs.versions.toml # + CST plugin & screenshot-validation-api
gradle.properties # + android.experimental.enableScreenshotTest=true
settings.gradle.kts # + include(":screenshot-tests")
.github/workflows/pull-request.yml # + screenshot validation step

feature/node/src/commonMain/.../NodeDetailPreviews.kt
core/ui/src/commonMain/.../component/*.kt # Theme wrapping consistency
feature/settings/src/commonMain/... # New previews (commonMain)
feature/connections/src/commonMain/... # New previews
feature/firmware/src/commonMain/... # New previews
feature/intro/src/commonMain/... # New previews (migrate from androidMain)

Structure Decision: The T383838screenshot-tests/ module sits at the repository root (same level as T383838app/, T383838desktop/, T383838core/, T383838feature/) because it is a cross-cutting test harness that spans multiple core and feature modules. It is NOT a KMP module β€” it is intentionally Android-only, using T383838com.android.library + CST plugin.

Constitution Check (Post-Design)

Re-evaluation after Phase 1 design.

β€’ I. KMP Core: βœ… Confirmed β€” no T383838commonMain contamination. The T383838screenshot-tests/ module is Android-only test infrastructure. All preview composables remain in T383838commonMain.
β€’ II. Zero Lint: βœ… Confirmed β€” T383838meshtastic.detekt and T383838meshtastic.spotless applied to T383838screenshot-tests/.
β€’ III. CMP UI: βœ… Confirmed β€” all previews use CMP annotations. T383838AppTheme is from T383838core/ui (CMP).
β€’ IV. Privacy: βœ… Confirmed β€” synthetic data only. No PII in reference images.
β€’ V. Design Standards: βœ… N/A β€” no new user-facing screens.
β€’ VI. Verify Before Push: βœ… Confirmed β€” commands listed above.

Complexity Tracking

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”
β”‚ Violation β”‚ Why Needed β”‚ Si… β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€
β”‚ Android-only module in KMP project β”‚ CST plugin is Android-only; cannot apply to KMP modu… β”‚ Ap… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”˜

Served by rngit 1.5.2 - Generated in 0.08s